package question1;

public class Student /*implements Comparable<Student>*/ {
    private String name;
    private String sex;
    private int   age;

    public Student() {
    }

    public Student(String name, String sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object obj) {
        return super.equals(obj);
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", age=" + age +
                '}';
    }

    //String类中重写了compareTo方法用于比较字符串
   /* @Override
    public int compareTo(Student o) {
        return (this.age-o.getAge())==0?(this.name.compareTo(o.getName())): (this.age-o.getAge());
    }*/
}
